home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / term.c < prev    next >
C/C++ Source or Header  |  1993-09-15  |  70KB  |  2,256 lines

  1. #ifndef lint
  2. static char *RCSid = "$Id: term.c%v 3.50.1.17 1993/08/27 05:21:33 woo Exp woo $";
  3. #endif
  4.  
  5.  
  6. /* GNUPLOT - term.c */
  7. /*
  8.  * Copyright (C) 1986 - 1993   Thomas Williams, Colin Kelley
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software is provided "as is" without express or implied warranty.
  21.  * 
  22.  *
  23.  * AUTHORS
  24.  * 
  25.  *   Original Software:
  26.  *     Thomas Williams,  Colin Kelley.
  27.  * 
  28.  *   Gnuplot 2.0 additions:
  29.  *       Russell Lang, Dave Kotz, John Campbell.
  30.  *
  31.  *   Gnuplot 3.0 additions:
  32.  *       Gershon Elber and many others.
  33.  * 
  34.  * There is a mailing list for gnuplot users. Note, however, that the
  35.  * newsgroup 
  36.  *    comp.graphics.gnuplot 
  37.  * is identical to the mailing list (they
  38.  * both carry the same set of messages). We prefer that you read the
  39.  * messages through that newsgroup, to subscribing to the mailing list.
  40.  * (If you can read that newsgroup, and are already on the mailing list,
  41.  * please send a message info-gnuplot-request@dartmouth.edu, asking to be
  42.  * removed from the mailing list.)
  43.  *
  44.  * The address for mailing to list members is
  45.  *       info-gnuplot@dartmouth.edu
  46.  * and for mailing administrative requests is 
  47.  *       info-gnuplot-request@dartmouth.edu
  48.  * The mailing list for bug reports is 
  49.  *       bug-gnuplot@dartmouth.edu
  50.  * The list of those interested in beta-test versions is
  51.  *       info-gnuplot-beta@dartmouth.edu
  52.  */
  53.  
  54. #include <stdio.h>
  55. #include <ctype.h>
  56. #include "plot.h"
  57. #include "setshow.h"
  58. #include "term.h"
  59. #include "bitmap.h"
  60. #ifdef NEXT
  61. #include <stdlib.h>
  62. #include "epsviewe.h"
  63. #endif /* NEXT */
  64.  
  65. #ifdef _Windows
  66. #ifdef __MSC__
  67. #include <malloc.h>
  68. #else
  69. #include <alloc.h>
  70. #endif
  71. #endif
  72.  
  73. #if defined(__TURBOC__) && defined(MSDOS)
  74. #ifndef _Windows
  75. #include <dos.h>
  76. #endif
  77. #endif
  78.  
  79. /* for use by all drivers */
  80. #define sign(x) ((x) >= 0 ? 1 : -1)
  81. #define abs(x) ((x) >= 0 ? (x) : -(x))
  82.  
  83. #ifndef max    /* GCC uses inline functions */
  84. #define max(a,b) ((a) > (b) ? (a) : (b))
  85. #endif
  86. #ifndef min
  87. #define min(a,b) ((a) < (b) ? (a) : (b))
  88. #endif
  89.  
  90. TBOOLEAN term_init;            /* true if terminal has been initialized */
  91.  
  92. extern FILE *outfile;
  93. extern char outstr[];
  94. extern TBOOLEAN term_init;
  95. extern int term;
  96. extern float xsize, ysize;
  97.  
  98. extern char input_line[];
  99. extern struct lexical_unit token[];
  100. extern int num_tokens, c_token;
  101. extern struct value *const_express();
  102.  
  103. extern TBOOLEAN interactive;
  104.  
  105. /*
  106.  * instead of <strings.h>
  107.  */
  108.  
  109. #if defined(_Windows) || ( defined(__TURBOC__) && defined(MSDOS) )
  110. # include <string.h>
  111. #else
  112. #ifdef ATARI
  113. #include <string.h>
  114. #include <math.h>
  115. #else
  116. #ifndef AMIGA_SC_6_1
  117. extern char *strcpy();
  118. #ifdef ANSI
  119. extern size_t   strlen();
  120. #else
  121. extern int      strlen();
  122. #endif
  123. extern int  strcmp(), strncmp();
  124. #endif /* !AMIGA_SC_6_1 */
  125. #endif
  126. #endif
  127.  
  128. #ifndef AMIGA_AC_5
  129. extern double sqrt();
  130. #endif
  131.  
  132. char *getenv();
  133.  
  134. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  135. char *turboc_init();
  136. #endif
  137.  
  138. #ifdef __ZTC__
  139. char *ztc_init();
  140. /* #undef TGIF */
  141. #endif
  142.  
  143.  
  144. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  145. void reopen_binary();
  146. #define REOPEN_BINARY
  147. #endif
  148. #ifdef vms
  149. char *vms_init();
  150. void vms_reset();
  151. void term_mode_tek();
  152. void term_mode_native();
  153. void term_pasthru();
  154. void term_nopasthru();
  155. void reopen_binary();
  156. void fflush_binary();
  157. #define REOPEN_BINARY
  158. #endif
  159.  
  160. /* This is needed because the unixplot library only writes to stdout. */
  161. #ifdef UNIXPLOT
  162. FILE save_stdout;
  163. #endif
  164. int unixplot=0;
  165.  
  166. #define NICE_LINE        0
  167. #define POINT_TYPES        6
  168.  
  169.  
  170. do_point(x,y,number)
  171. int x,y;
  172. int number;
  173. {
  174. register int htic,vtic;
  175. register struct termentry *t = &term_tbl[term];
  176.  
  177.      if (number < 0) {        /* do dot */
  178.         (*t->move)(x,y);
  179.         (*t->vector)(x,y);
  180.         return(0);
  181.     }
  182.  
  183.     number %= POINT_TYPES;
  184.     htic = (t->h_tic/2);    /* should be in term_tbl[] in later version */
  185.     vtic = (t->v_tic/2);    
  186.  
  187.     switch(number) {
  188.         case 0: /* do diamond */ 
  189.                 (*t->move)(x-htic,y);
  190.                 (*t->vector)(x,y-vtic);
  191.                 (*t->vector)(x+htic,y);
  192.                 (*t->vector)(x,y+vtic);
  193.                 (*t->vector)(x-htic,y);
  194.                 (*t->move)(x,y);
  195.                 (*t->vector)(x,y);
  196.                 break;
  197.         case 1: /* do plus */ 
  198.                 (*t->move)(x-htic,y);
  199.                 (*t->vector)(x-htic,y);
  200.                 (*t->vector)(x+htic,y);
  201.                 (*t->move)(x,y-vtic);
  202.                 (*t->vector)(x,y-vtic);
  203.                 (*t->vector)(x,y+vtic);
  204.                 break;
  205.         case 2: /* do box */ 
  206.                 (*t->move)(x-htic,y-vtic);
  207.                 (*t->vector)(x-htic,y-vtic);
  208.                 (*t->vector)(x+htic,y-vtic);
  209.                 (*t->vector)(x+htic,y+vtic);
  210.                 (*t->vector)(x-htic,y+vtic);
  211.                 (*t->vector)(x-htic,y-vtic);
  212.                 (*t->move)(x,y);
  213.                 (*t->vector)(x,y);
  214.                 break;
  215.         case 3: /* do X */ 
  216.                 (*t->move)(x-htic,y-vtic);
  217.                 (*t->vector)(x-htic,y-vtic);
  218.                 (*t->vector)(x+htic,y+vtic);
  219.                 (*t->move)(x-htic,y+vtic);
  220.                 (*t->vector)(x-htic,y+vtic);
  221.                 (*t->vector)(x+htic,y-vtic);
  222.                 break;
  223.         case 4: /* do triangle */ 
  224.                 (*t->move)(x,y+(4*vtic/3));
  225.                 (*t->vector)(x-(4*htic/3),y-(2*vtic/3));
  226.                 (*t->vector)(x+(4*htic/3),y-(2*vtic/3));
  227.                 (*t->vector)(x,y+(4*vtic/3));
  228.                 (*t->move)(x,y);
  229.                 (*t->vector)(x,y);
  230.                 break;
  231.         case 5: /* do star */ 
  232.                 (*t->move)(x-htic,y);
  233.                 (*t->vector)(x-htic,y);
  234.                 (*t->vector)(x+htic,y);
  235.                 (*t->move)(x,y-vtic);
  236.                 (*t->vector)(x,y-vtic);
  237.                 (*t->vector)(x,y+vtic);
  238.                 (*t->move)(x-htic,y-vtic);
  239.                 (*t->vector)(x-htic,y-vtic);
  240.                 (*t->vector)(x+htic,y+vtic);
  241.                 (*t->move)(x-htic,y+vtic);
  242.                 (*t->vector)(x-htic,y+vtic);
  243.                 (*t->vector)(x+htic,y-vtic);
  244.                 break;
  245.     }
  246. }
  247.  
  248.  
  249. /*
  250.  * general point routine
  251.  */
  252. line_and_point(x,y,number)
  253. int x,y,number;
  254. {
  255.     /* temporary(?) kludge to allow terminals with bad linetypes 
  256.         to make nice marks */
  257.  
  258.     (*term_tbl[term].linetype)(NICE_LINE);
  259.     do_point(x,y,number);
  260. }
  261.  
  262. /* 
  263.  * general arrow routine
  264.  */
  265. #define ROOT2 (1.41421)        /* sqrt of 2 */
  266.  
  267. do_arrow(sx, sy, ex, ey, head)
  268.     int sx,sy;            /* start point */
  269.     int ex, ey;            /* end point (point of arrowhead) */
  270.     TBOOLEAN head;
  271. {
  272.     register struct termentry *t = &term_tbl[term];
  273.     int len = (t->h_tic + t->v_tic)/2; /* arrowhead size = avg of tic sizes */
  274.  
  275.     /* draw the line for the arrow. That's easy. */
  276.     (*t->move)(sx, sy);
  277.     (*t->vector)(ex, ey);
  278.  
  279.     if (head) {
  280.     /* now draw the arrow head. */
  281.     /* we put the arrowhead marks at 45 degrees to line */
  282.        if (sx == ex) {
  283.        /* vertical line, special case */
  284.           int delta = ((float)len / ROOT2 + 0.5);
  285.           if (sy < ey)
  286.               delta = -delta;    /* up arrow goes the other way */
  287.           (*t->move)(ex - delta, ey + delta);
  288.           (*t->vector)(ex,ey);
  289.           (*t->vector)(ex + delta, ey + delta);
  290.        } else {
  291.           int dx = sx - ex;
  292.           int dy = sy - ey;
  293.           double coeff = len / sqrt(2.0*((double)dx*(double)dx 
  294.                    + (double)dy*(double)dy));
  295.           int x,y;            /* one endpoint */
  296.  
  297.           x = (int)( ex + (dx + dy) * coeff );
  298.           y = (int)( ey + (dy - dx) * coeff );
  299.           (*t->move)(x,y);
  300.           (*t->vector)(ex,ey);
  301.  
  302.           x = (int)( ex + (dx - dy) * coeff );
  303.           y = (int)( ey + (dy + dx) * coeff );
  304.           (*t->vector)(x,y);
  305.        }
  306.     }
  307. }
  308.  
  309. #ifdef DUMB                    /* paper or glass dumb terminal */
  310. #include "term/dumb.trm"
  311. #endif
  312.  
  313.  
  314. #ifndef _Windows
  315. # ifdef PC            /* all PC types except MS WINDOWS*/
  316. #  include "term/pc.trm"
  317. # endif
  318. #else
  319. #  include "term/win.trm"
  320. #endif
  321.  
  322. #ifdef __ZTC__
  323. #include "term/fg.trm"
  324. #endif
  325.  
  326. #ifdef DJSVGA
  327. #include "term/djsvga.trm"    /* DJGPP SVGA */
  328. #endif
  329.  
  330. #ifdef EMXVGA
  331. #include "term/emxvga.trm"    /* EMX VGA */
  332. #endif
  333.  
  334. #ifdef OS2PM                    /* os/2 presentation manager */
  335. #include "term/pm.trm"
  336. #endif
  337.  
  338. #ifdef ATARI            /* ATARI-ST */
  339. #include "term/atari.trm"
  340. #endif
  341.  
  342. /*
  343.    all TEK types (TEK,BITGRAPH,KERMIT,VTTEK,SELANAR) are ifdef'd in tek.trm,
  344.    but most require various TEK routines.  Hence TEK must be defined for
  345.    the others to compile.
  346. */
  347. #ifdef BITGRAPH
  348. # ifndef TEK
  349. #  define TEK
  350. # endif
  351. #endif
  352.  
  353. #ifdef SELENAR
  354. # ifndef TEK
  355. #  define TEK
  356. # endif
  357. #endif
  358.  
  359. #ifdef KERMIT
  360. # ifndef TEK
  361. #  define TEK
  362. # endif
  363. #endif
  364.  
  365. #ifdef LN03P
  366. # ifndef TEK
  367. #  define TEK
  368. # endif
  369. #endif
  370.  
  371. #ifdef VTTEK
  372. # ifndef TEK
  373. #  define TEK
  374. # endif
  375. #endif
  376.  
  377. #ifdef T410X        /* Tektronix 4106, 4107, 4109 and 420x terminals */
  378. #include "term/t410x.trm"
  379. #endif
  380.  
  381. #ifdef TEK            /* all TEK types, TEK, BBN, SELANAR, KERMIT, VTTEK */
  382. #include "term/tek.trm"
  383. #endif
  384.  
  385. #ifdef OKIDATA
  386. #define EPSONP
  387. #endif
  388.  
  389. #ifdef EPSONP    /* bit map types, EPSON, NEC, PROPRINTER, STAR Color */
  390. #include "term/epson.trm"
  391. #endif
  392.  
  393. #ifdef HP500C  /* HP 500 deskjet Colour */
  394. #include "term/hp500c.trm"
  395. #endif
  396.  
  397. #ifdef HPLJII        /* HP LaserJet II */
  398. #include "term/hpljii.trm"
  399. #endif
  400.  
  401. #ifdef PCL /* HP LaserJet III in HPGL mode */
  402. #  ifndef HPGL
  403. #    define HPGL
  404. #  endif
  405. #endif
  406.  
  407. #ifdef HPPJ        /* HP PaintJet */
  408. #include "term/hppj.trm"
  409. #endif
  410.  
  411. #ifdef FIG            /* Fig 2.1 Interactive graphics program */
  412. #include "term/fig.trm"
  413. #include "term/bigfig.trm"
  414. #endif
  415.   
  416. #ifdef GPR              /* Apollo Graphics Primitive Resource (fixed-size window) */
  417. #include "term/gpr.trm"
  418. #endif /* GPR */
  419.  
  420. #ifdef GRASS              /* GRASS (geographic info system) monitor */
  421. #include "term/grass.trm"
  422. #endif /* GRASS */
  423.  
  424. #ifdef APOLLO           /* Apollo Graphics Primitive Resource (resizable window) */
  425. #include "term/apollo.trm"
  426. #endif /* APOLLO */
  427.  
  428. #ifdef IMAGEN        /* IMAGEN printer */
  429. #include "term/imagen.trm"
  430. #endif
  431.  
  432. #ifdef MIF            /* Framemaker MIF  driver */
  433. #include "term/mif.trm"
  434. #endif
  435.  
  436. #ifdef MF            /* METAFONT driver */
  437. #include "term/metafont.trm"
  438. #endif
  439.  
  440. #ifdef TEXDRAW
  441. #include "term/texdraw.trm"
  442. #endif
  443.  
  444. #ifdef EEPIC        /* EEPIC (LATEX) type */
  445. #include "term/eepic.trm"
  446. # ifndef LATEX
  447. #  define LATEX
  448. # endif
  449. #endif
  450.  
  451. #ifdef EMTEX        /* EMTEX (LATEX for PC) type */
  452. # ifndef LATEX
  453. #  define LATEX
  454. # endif
  455. #endif
  456.  
  457. #ifdef LATEX        /* LATEX type */
  458. #include "term/latex.trm"
  459. #endif
  460.  
  461. #ifdef GPIC        /* GPIC (groff) type */ 
  462. #include "term/gpic.trm"
  463. #endif
  464.  
  465. #ifdef PBM        /* PBMPLUS portable bitmap */
  466. #include "term/pbm.trm"
  467. #endif
  468.  
  469. #ifdef POSTSCRIPT    /* POSTSCRIPT type */
  470. #include "term/post.trm"
  471. #endif
  472.  
  473. #ifdef PRESCRIBE    /* PRESCRIBE type */
  474. #include "term/kyo.trm"
  475. #endif
  476.  
  477. /* note: this must come after term/post.trm */
  478. #ifdef PSLATEX        /* LaTeX with embedded PostScript */
  479. #include "term/pslatex.trm"
  480. #endif
  481.  
  482. #ifdef PSTRICKS
  483. #include "term/pstricks.trm"
  484. #endif
  485.  
  486. #ifdef TPIC        /* TPIC (LATEX) type */
  487. #include "term/tpic.trm"
  488. # ifndef LATEX
  489. #  define LATEX
  490. # endif
  491. #endif
  492.  
  493. #ifdef UNIXPC     /* unix-PC  ATT 7300 or 3b1 machine */
  494. #include "term/unixpc.trm"
  495. #endif /* UNIXPC */
  496.  
  497. #ifdef AED
  498. #include "term/aed.trm"
  499. #endif /* AED */
  500.  
  501. #ifdef AIFM
  502. #include "term/ai.trm"
  503. #endif /* AIFM */
  504.  
  505. #ifdef COREL
  506. #include "term/corel.trm"
  507. #endif /* COREL */
  508.  
  509. #ifdef CGI
  510. #include "term/cgi.trm"
  511. #endif /* CGI */
  512.  
  513. #ifdef DEBUG
  514. #include "term/debug.trm"
  515. #endif /* DEBUG */
  516.  
  517. #ifdef EXCL
  518. #include "term/excl.trm"
  519. #endif /* EXCL */
  520.  
  521. #ifdef HP2648
  522. /* also works for HP2647 */
  523. #include "term/hp2648.trm"
  524. #endif /* HP2648 */
  525.  
  526. #ifdef HP26
  527. #include "term/hp26.trm"
  528. #endif /* HP26 */
  529.  
  530. #ifdef HP75
  531. #ifndef HPGL
  532. #define HPGL
  533. #endif
  534. #endif
  535.  
  536. /* HPGL - includes HP75 and HPLJIII in HPGL mode */
  537. #ifdef HPGL
  538. #include "term/hpgl.trm"
  539. #endif /* HPGL */
  540.  
  541. /* Roland DXY800A plotter driver by Martin Yii, eln557h@monu3.OZ 
  542.     and Russell Lang, rjl@monu1.cc.monash.oz */
  543. #ifdef DXY800A
  544. #include "term/dxy.trm"
  545. #endif /* DXY800A */
  546.  
  547. #ifdef IRIS4D
  548. #include "term/iris4d.trm"
  549. #endif /* IRIS4D */
  550.  
  551. #ifdef NEXT
  552. #include "term/next.trm"
  553. #endif /* NEXT */
  554.  
  555. #ifdef QMS
  556. #include "term/qms.trm"
  557. #endif /* QMS */
  558.  
  559. #ifdef REGIS
  560. #include "term/regis.trm"
  561. #endif /* REGIS */
  562.  
  563. #ifdef RGIP
  564. #include "term/rgip.trm"
  565. #endif /* RGIP UNIPLEX */
  566.  
  567. #ifdef MGR
  568. #include "term/mgr.trm"
  569. #endif /* MGR */
  570.  
  571. #ifdef SUN
  572. #include "term/sun.trm"
  573. #endif /* SUN */
  574.  
  575. #ifdef VWS
  576. #include "term/vws.trm"
  577. #endif /* VWS */
  578.  
  579. #ifdef V384
  580. #include "term/v384.trm"
  581. #endif /* V384 */
  582.  
  583. #ifdef TGIF
  584. #include "term/tgif.trm"
  585. #endif /* TGIF */
  586.  
  587. #ifdef UNIXPLOT
  588. #ifdef GNUGRAPH
  589. #include "term/gnugraph.trm"
  590. #else
  591. #include "term/unixplot.trm"
  592. #endif /* GNUGRAPH */
  593. #endif /* UNIXPLOT */
  594.  
  595. #ifdef X11
  596. #include "term/x11.trm"
  597. #include "term/xlib.trm"
  598. #endif /* X11 */
  599.  
  600. #ifdef DXF
  601. #include "term/dxf.trm"
  602. #endif /* DXF */
  603.   
  604. #ifdef AMIGASCREEN
  605. #include "term/amiga.trm"
  606. #endif /* AMIGASCREEN */
  607.  
  608. /* Dummy functions for unavailable features */
  609.  
  610. /* change angle of text.  0 is horizontal left to right.
  611. * 1 is vertical bottom to top (90 deg rotate)  
  612. */
  613. static int null_text_angle()
  614. {
  615. return FALSE ;    /* can't be done */
  616. }
  617.  
  618. /* change justification of text.  
  619.  * modes are LEFT (flush left), CENTRE (centred), RIGHT (flush right)
  620.  */
  621. static int null_justify_text()
  622. {
  623. return FALSE ;    /* can't be done */
  624. }
  625.  
  626.  
  627. /* Change scale of plot.
  628.  * Parameters are x,y scaling factors for this plot.
  629.  * Some terminals (eg latex) need to do scaling themselves.
  630.  */
  631. static int null_scale()
  632. {
  633. return FALSE ;    /* can't be done */
  634. }
  635.  
  636. static int do_scale()
  637. {
  638. return TRUE ;    /* can be done */
  639. }
  640.  
  641. options_null()
  642. {
  643.     term_options[0] = '\0';    /* we have no options */
  644. }
  645.  
  646. static UNKNOWN_null()
  647. {
  648. }
  649.  
  650. /*
  651.  * term_tbl[] contains an entry for each terminal.  "unknown" must be the
  652.  *   first, since term is initialized to 0.
  653.  */
  654. struct termentry term_tbl[] = {
  655.     {"unknown", "Unknown terminal type - not a plotting device",
  656.       100, 100, 1, 1,
  657.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  658.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  659.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  660.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  661.  
  662.     ,{"table", "Dump ASCII table of X Y [Z] values to output",
  663.       100, 100, 1, 1,
  664.       1, 1, options_null, UNKNOWN_null, UNKNOWN_null, 
  665.       UNKNOWN_null, null_scale, UNKNOWN_null, UNKNOWN_null, UNKNOWN_null, 
  666.       UNKNOWN_null, UNKNOWN_null, null_text_angle, 
  667.       null_justify_text, UNKNOWN_null, UNKNOWN_null}
  668.  
  669. #ifdef AMIGASCREEN
  670.     ,{"amiga", "Amiga Custom Screen",
  671.        AMIGA_XMAX, AMIGA_YMAX, AMIGA_VCHAR, AMIGA_HCHAR, 
  672.        AMIGA_VTIC, AMIGA_HTIC, options_null, AMIGA_init, AMIGA_reset, 
  673.        AMIGA_text, null_scale, AMIGA_graphics, AMIGA_move, AMIGA_vector,
  674.        AMIGA_linetype, AMIGA_put_text, null_text_angle, 
  675.        AMIGA_justify_text, do_point, do_arrow}
  676. #endif
  677.  
  678. #ifdef ATARI
  679.     ,{"atari", "Atari ST/TT",
  680.        ATARI_XMAX, ATARI_YMAX, ATARI_VCHAR, ATARI_HCHAR, 
  681.        ATARI_VTIC, ATARI_HTIC, ATARI_options, ATARI_init, ATARI_reset, 
  682.        ATARI_text, null_scale, ATARI_graphics, ATARI_move, ATARI_vector, 
  683.        ATARI_linetype, ATARI_put_text, ATARI_text_angle, 
  684.        null_justify_text, ATARI_point, do_arrow}
  685. #endif
  686.  
  687. #ifdef DUMB
  688.     ,{"dumb", "printer or glass dumb terminal",
  689.          DUMB_XMAX, DUMB_YMAX, 1, 1,
  690.          1, 1, DUMB_options, DUMB_init, DUMB_reset,
  691.          DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
  692.          DUMB_linetype, DUMB_put_text, null_text_angle,
  693.          null_justify_text, DUMB_point, DUMB_arrow}
  694. #endif
  695.  
  696. #ifdef PC
  697. #ifndef _Windows
  698. # ifdef __TURBOC__
  699. #ifdef ATT6300
  700.     ,{"att", "IBM PC/Clone with AT&T 6300 graphics board",
  701.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  702.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  703.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  704.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  705.        ATT_justify_text, line_and_point, do_arrow}
  706. #endif
  707.  
  708.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  709.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  710.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  711.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  712.        CGA_linetype, CGA_put_text, MCGA_text_angle, 
  713.        CGA_justify_text, line_and_point, do_arrow}
  714.  
  715.     ,{"egalib", "IBM PC/Clone with EGA graphics board",
  716.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  717.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  718.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  719.        EGALIB_linetype, EGALIB_put_text, EGALIB_text_angle, 
  720.        EGALIB_justify_text, do_point, do_arrow}
  721.  
  722.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  723.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  724.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  725.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  726.        HERC_linetype, HERC_put_text, MCGA_text_angle, 
  727.        HERC_justify_text, line_and_point, do_arrow}
  728.  
  729.     ,{"mcga", "IBM PC/Clone with MCGA graphics board",
  730.        MCGA_XMAX, MCGA_YMAX, MCGA_VCHAR, MCGA_HCHAR,
  731.        MCGA_VTIC, MCGA_HTIC, options_null, MCGA_init, MCGA_reset,
  732.        MCGA_text, null_scale, MCGA_graphics, MCGA_move, MCGA_vector,
  733.        MCGA_linetype, MCGA_put_text, MCGA_text_angle, 
  734.        MCGA_justify_text, line_and_point, do_arrow}
  735.  
  736.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  737.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  738.        SVGA_VTIC, SVGA_HTIC, options_null, SVGA_init, SVGA_reset,
  739.        SVGA_text, null_scale, SVGA_graphics, SVGA_move, SVGA_vector,
  740.        SVGA_linetype, SVGA_put_text, SVGA_text_angle, 
  741.        SVGA_justify_text, do_point, do_arrow}
  742.  
  743.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  744.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  745.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  746.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  747.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  748.        VGA_justify_text, do_point, do_arrow}
  749.  
  750.     ,{"vgamono", "IBM PC/Clone with VGA Monochrome graphics board",
  751.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  752.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  753.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  754.        VGAMONO_linetype, VGA_put_text, VGA_text_angle, 
  755.        VGA_justify_text, line_and_point, do_arrow}
  756. #else                    /* TURBO */
  757.  
  758. #ifdef ATT6300
  759.     ,{"att", "AT&T PC/6300 graphics",
  760.        ATT_XMAX, ATT_YMAX, ATT_VCHAR, ATT_HCHAR,
  761.        ATT_VTIC, ATT_HTIC, options_null, ATT_init, ATT_reset,
  762.        ATT_text, null_scale, ATT_graphics, ATT_move, ATT_vector,
  763.        ATT_linetype, ATT_put_text, ATT_text_angle, 
  764.        null_justify_text, line_and_point, do_arrow}
  765. #endif
  766.  
  767.     ,{"cga", "IBM PC/Clone with CGA graphics board",
  768.        CGA_XMAX, CGA_YMAX, CGA_VCHAR, CGA_HCHAR,
  769.        CGA_VTIC, CGA_HTIC, options_null, CGA_init, CGA_reset,
  770.        CGA_text, null_scale, CGA_graphics, CGA_move, CGA_vector,
  771.        CGA_linetype, CGA_put_text, CGA_text_angle, 
  772.        null_justify_text, line_and_point, do_arrow}
  773.  
  774. #ifdef CORONA
  775.     ,{"corona325", "Corona graphics ???",
  776.        COR_XMAX, COR_YMAX, COR_VCHAR, COR_HCHAR,
  777.        COR_VTIC, COR_HTIC, options_null, COR_init, COR_reset,
  778.        COR_text, null_scale, COR_graphics, COR_move, COR_vector,
  779.        COR_linetype, COR_put_text, COR_text_angle, 
  780.        null_justify_text, line_and_point, do_arrow}
  781. #endif                    /* CORONA */
  782.  
  783.     ,{"egabios", "IBM PC/Clone with EGA graphics board (BIOS)",
  784.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  785.        EGA_VTIC, EGA_HTIC, options_null, EGA_init, EGA_reset,
  786.        EGA_text, null_scale, EGA_graphics, EGA_move, EGA_vector,
  787.        EGA_linetype, EGA_put_text, EGA_text_angle, 
  788.        null_justify_text, do_point, do_arrow}
  789.  
  790. #ifdef EGALIB
  791.     ,{"egalib", "IBM PC/Clone with EGA graphics board (LIB)",
  792.        EGALIB_XMAX, EGALIB_YMAX, EGALIB_VCHAR, EGALIB_HCHAR,
  793.        EGALIB_VTIC, EGALIB_HTIC, options_null, EGALIB_init, EGALIB_reset,
  794.        EGALIB_text, null_scale, EGALIB_graphics, EGALIB_move, EGALIB_vector,
  795.        EGALIB_linetype, EGALIB_put_text, null_text_angle, 
  796.        null_justify_text, do_point, do_arrow}
  797. #endif
  798.  
  799. #ifdef HERCULES
  800.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  801.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  802.        HERC_VTIC, HERC_HTIC, options_null, HERC_init, HERC_reset,
  803.        HERC_text, null_scale, HERC_graphics, HERC_move, HERC_vector,
  804.        HERC_linetype, HERC_put_text, HERC_text_angle, 
  805.        null_justify_text, line_and_point, do_arrow}
  806. #endif                    /* HERCULES */
  807.  
  808.     ,{"vgabios", "IBM PC/Clone with VGA graphics board (BIOS)",
  809.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  810.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  811.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  812.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  813.        null_justify_text, do_point, do_arrow}
  814.  
  815. #endif                    /* TURBO */
  816. #endif                    /* _Windows */
  817. #endif                    /* PC */
  818.  
  819. #ifdef __ZTC__         /* zortech C flashgraphics for 386 */
  820.     ,{"hercules", "IBM PC/Clone with Hercules graphics board",
  821.        HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
  822.        HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
  823.        VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
  824.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  825.        VGA_justify_text, do_point, do_arrow}
  826.  
  827.     ,{"egamono", "IBM PC/Clone with monochrome EGA graphics board",
  828.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  829.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  830.        VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
  831.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  832.        VGA_justify_text, do_point, do_arrow}
  833.  
  834.     ,{"egalib", "IBM PC/Clone with color EGA graphics board",
  835.        EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
  836.        EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
  837.        VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
  838.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  839.        VGA_justify_text, do_point, do_arrow}
  840.  
  841.     ,{"vgalib", "IBM PC/Clone with VGA graphics board",
  842.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  843.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  844.        VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
  845.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  846.        VGA_justify_text, do_point, do_arrow}
  847.  
  848.     ,{"vgamono", "IBM PC/Clone with monochrome VGA graphics board",
  849.        VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
  850.        VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
  851.        VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
  852.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  853.        VGA_justify_text, do_point, do_arrow}
  854.  
  855.     ,{"svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
  856.        SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
  857.        SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
  858.        VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
  859.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  860.        VGA_justify_text, do_point, do_arrow}
  861.  
  862.     ,{"ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
  863.        SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
  864.        SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
  865.        VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
  866.        VGA_linetype, VGA_put_text, VGA_text_angle, 
  867.        VGA_justify_text, do_point, do_arrow}
  868. #endif    /* __ZTC__ */
  869.  
  870. #ifdef AED
  871.     ,{"aed512", "AED 512 Terminal",
  872.        AED5_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  873.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  874.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  875.        AED_linetype, AED_put_text, null_text_angle, 
  876.        null_justify_text, do_point, do_arrow}
  877.     ,{"aed767", "AED 767 Terminal",
  878.        AED_XMAX, AED_YMAX, AED_VCHAR, AED_HCHAR,
  879.        AED_VTIC, AED_HTIC, options_null, AED_init, AED_reset, 
  880.        AED_text, null_scale, AED_graphics, AED_move, AED_vector, 
  881.        AED_linetype, AED_put_text, null_text_angle, 
  882.        null_justify_text, do_point, do_arrow}
  883. #endif
  884.  
  885. #ifdef AIFM
  886.     ,{"aifm", "Adobe Illustrator 3.0 Format",
  887.        AI_XMAX, AI_YMAX, AI_VCHAR, AI_HCHAR, 
  888.        AI_VTIC, AI_HTIC, AI_options, AI_init, AI_reset, 
  889.        AI_text, null_scale, AI_graphics, AI_move, AI_vector, 
  890.        AI_linetype, AI_put_text, AI_text_angle, 
  891.        AI_justify_text, do_point, do_arrow}
  892. #endif
  893.  
  894. #ifdef APOLLO
  895.        ,{"apollo", "Apollo Graphics Primitive Resource, rescaling of subsequent plots after window resizing",
  896.        0, 0, 0, 0, /* APOLLO_XMAX, APOLLO_YMAX, APOLLO_VCHAR, APOLLO_HCHAR, are filled in at run-time */
  897.        APOLLO_VTIC, APOLLO_HTIC, options_null, APOLLO_init, APOLLO_reset,
  898.        APOLLO_text, null_scale, APOLLO_graphics, APOLLO_move, APOLLO_vector,
  899.        APOLLO_linetype, APOLLO_put_text, APOLLO_text_angle,
  900.        APOLLO_justify_text, line_and_point, do_arrow}
  901. #endif
  902.  
  903. #ifdef GPR
  904.        ,{"gpr", "Apollo Graphics Primitive Resource, fixed-size window",
  905.        GPR_XMAX, GPR_YMAX, GPR_VCHAR, GPR_HCHAR,
  906.        GPR_VTIC, GPR_HTIC, options_null, GPR_init, GPR_reset,
  907.        GPR_text, null_scale, GPR_graphics, GPR_move, GPR_vector,
  908.        GPR_linetype, GPR_put_text, GPR_text_angle,
  909.        GPR_justify_text, line_and_point, do_arrow}
  910. #endif
  911.  
  912. #ifdef BITGRAPH
  913.     ,{"bitgraph", "BBN Bitgraph Terminal",
  914.        BG_XMAX,BG_YMAX,BG_VCHAR, BG_HCHAR, 
  915.        BG_VTIC, BG_HTIC, options_null, BG_init, BG_reset, 
  916.        BG_text, null_scale, BG_graphics, BG_move, BG_vector,
  917.        BG_linetype, BG_put_text, null_text_angle, 
  918.        null_justify_text, line_and_point, do_arrow}
  919. #endif
  920.  
  921. #ifdef COREL
  922.     ,{"corel","EPS format for CorelDRAW",
  923.      CORELD_XMAX, CORELD_YMAX, CORELD_VCHAR, CORELD_HCHAR,
  924.      CORELD_VTIC, CORELD_HTIC, COREL_options, COREL_init, COREL_reset,
  925.      COREL_text, null_scale, COREL_graphics, COREL_move, COREL_vector,
  926.      COREL_linetype, COREL_put_text, COREL_text_angle,
  927.      COREL_justify_text, do_point, do_arrow}
  928. #endif
  929.  
  930. #ifdef CGI
  931.     ,{"cgi", "SCO CGI drivers (requires CGIDISP or CGIPRNT env variable)",
  932.        CGI_XMAX, CGI_YMAX, 0, 0, 
  933.        CGI_VTIC, 0, options_null, CGI_init, CGI_reset, 
  934.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  935.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  936.        CGI_justify_text, CGI_point, do_arrow}
  937.  
  938.     ,{"hcgi", "SCO CGI drivers (hardcopy, requires CGIPRNT env variable)",
  939.        CGI_XMAX, CGI_YMAX, 0, 0, 
  940.        CGI_VTIC, 0, options_null, HCGI_init, CGI_reset, 
  941.        CGI_text, null_scale, CGI_graphics, CGI_move, CGI_vector, 
  942.        CGI_linetype, CGI_put_text, CGI_text_angle, 
  943.        CGI_justify_text, CGI_point, do_arrow}
  944. #endif
  945.  
  946. #ifdef DEBUG
  947.     ,{"debug", "debugging driver",
  948.        DEBUG_XMAX, DEBUG_YMAX, DEBUG_VCHAR, DEBUG_HCHAR,
  949.        DEBUG_VTIC, DEBUG_HTIC, options_null, DEBUG_init, DEBUG_reset,
  950.        DEBUG_text, null_scale, DEBUG_graphics, DEBUG_move, DEBUG_vector,
  951.        DEBUG_linetype, DEBUG_put_text, null_text_angle, 
  952.        DEBUG_justify_text, line_and_point, do_arrow}
  953. #endif
  954.  
  955. #ifdef DJSVGA
  956.     ,{"svga", "IBM PC/Clone with Super VGA graphics board",
  957.        DJSVGA_XMAX, DJSVGA_YMAX, DJSVGA_VCHAR, DJSVGA_HCHAR,
  958.        DJSVGA_VTIC, DJSVGA_HTIC, options_null, DJSVGA_init, DJSVGA_reset,
  959.        DJSVGA_text, null_scale, DJSVGA_graphics, DJSVGA_move, DJSVGA_vector,
  960.        DJSVGA_linetype, DJSVGA_put_text, null_text_angle, 
  961.        null_justify_text, do_point, do_arrow}
  962. #endif
  963.  
  964. #ifdef DXF
  965.     ,{"dxf", "dxf-file for AutoCad (default size 120x80)",
  966.        DXF_XMAX,DXF_YMAX,DXF_VCHAR, DXF_HCHAR,
  967.        DXF_VTIC, DXF_HTIC, options_null,DXF_init, DXF_reset,
  968.        DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
  969.        DXF_linetype, DXF_put_text, DXF_text_angle,
  970.        DXF_justify_text, do_point, do_arrow}
  971. #endif
  972.  
  973. #ifdef DXY800A
  974.     ,{"dxy800a", "Roland DXY800A plotter",
  975.        DXY_XMAX, DXY_YMAX, DXY_VCHAR, DXY_HCHAR,
  976.        DXY_VTIC, DXY_HTIC, options_null, DXY_init, DXY_reset,
  977.        DXY_text, null_scale, DXY_graphics, DXY_move, DXY_vector,
  978.        DXY_linetype, DXY_put_text, DXY_text_angle, 
  979.        null_justify_text, do_point, do_arrow}
  980. #endif
  981.  
  982. #ifdef EEPIC
  983.     ,{"eepic", "EEPIC -- extended LaTeX picture environment",
  984.        EEPIC_XMAX, EEPIC_YMAX, EEPIC_VCHAR, EEPIC_HCHAR, 
  985.        EEPIC_VTIC, EEPIC_HTIC, options_null, EEPIC_init, EEPIC_reset, 
  986.        EEPIC_text, EEPIC_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector, 
  987.        EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle, 
  988.        EEPIC_justify_text, EEPIC_point, EEPIC_arrow}
  989. #endif
  990.  
  991. #ifdef EMTEX
  992.     ,{"emtex", "LaTeX picture environment with emTeX specials",
  993.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  994.        LATEX_VTIC, LATEX_HTIC, LATEX_options, EMTEX_init, EMTEX_reset, 
  995.        EMTEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  996.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  997.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  998. #endif
  999.  
  1000. #ifdef EPS180
  1001.     ,{"epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
  1002.        EPS180XMAX, EPS180YMAX, EPSON180VCHAR, EPSON180HCHAR,
  1003.        EPSON180VTIC, EPSON180HTIC, options_null, EPSONinit, EPSONreset,
  1004.        EPS180text, null_scale, EPS180graphics, EPSONmove, EPSONvector,
  1005.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1006.        null_justify_text, do_point, do_arrow}
  1007. #endif
  1008.  
  1009. #ifdef EPS60
  1010.     ,{"epson_60dpi", "Epson-style 60-dot per inch printers",
  1011.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1012.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1013.        EPS60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1014.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1015.        null_justify_text, do_point, do_arrow}
  1016. #endif
  1017.  
  1018. #ifdef EPSONP
  1019.     ,{"epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
  1020.        EPSONXMAX, EPSONYMAX, EPSONVCHAR, EPSONHCHAR, 
  1021.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset, 
  1022.        EPSONtext, null_scale, EPSONgraphics, EPSONmove, EPSONvector, 
  1023.        EPSONlinetype, EPSONput_text, EPSON_text_angle, 
  1024.        null_justify_text, line_and_point, do_arrow}
  1025. #endif
  1026.  
  1027. #ifdef EXCL
  1028.     ,{"excl", "Talaris EXCL Laser printer (also Talaris 1590 and others)",
  1029.        EXCL_XMAX,EXCL_YMAX, EXCL_VCHAR, EXCL_HCHAR, 
  1030.        EXCL_VTIC, EXCL_HTIC, options_null, EXCL_init,EXCL_reset, 
  1031.        EXCL_text, null_scale, EXCL_graphics, EXCL_move, EXCL_vector,
  1032.        EXCL_linetype,EXCL_put_text, null_text_angle, 
  1033.        null_justify_text, line_and_point, do_arrow}
  1034. #endif
  1035.  
  1036.  
  1037. #ifdef FIG
  1038.     ,{"fig", "FIG 2.1 graphics language: SunView or X graphics editor",
  1039.        FIG_XMAX, FIG_YMAX, FIG_VCHAR, FIG_HCHAR, 
  1040.        FIG_VTIC, FIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1041.        FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector, 
  1042.        FIG_linetype, FIG_put_text, FIG_text_angle, 
  1043.        FIG_justify_text, line_and_point, FIG_arrow}
  1044.     ,{"bfig", "FIG 2.1 graphics lang: SunView or X graphics editor. Large Graph",
  1045.        BFIG_XMAX, BFIG_YMAX, BFIG_VCHAR, BFIG_HCHAR, 
  1046.        BFIG_VTIC, BFIG_HTIC, FIG_options, FIG_init, FIG_reset, 
  1047.        FIG_text, null_scale, FIG_graphics, FIG_move, BFIG_vector, 
  1048.        FIG_linetype, BFIG_put_text, FIG_text_angle, 
  1049.        FIG_justify_text, line_and_point, BFIG_arrow}
  1050. #endif
  1051.  
  1052. #ifdef GPIC
  1053.     ,{"gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
  1054.        GPIC_XMAX, GPIC_YMAX, GPIC_VCHAR, GPIC_HCHAR, 
  1055.        GPIC_VTIC, GPIC_HTIC, GPIC_options, GPIC_init, GPIC_reset, 
  1056.        GPIC_text, GPIC_scale, GPIC_graphics, GPIC_move, GPIC_vector, 
  1057.        GPIC_linetype, GPIC_put_text, GPIC_text_angle, 
  1058.        GPIC_justify_text, line_and_point, GPIC_arrow}
  1059. #endif
  1060.  
  1061. #ifdef GRASS
  1062.     ,{"grass", "GRASS Graphics Monitor",
  1063.            GRASS_XMAX, GRASS_YMAX, GRASS_VCHAR, GRASS_HCHAR,
  1064.            GRASS_VTIC, GRASS_HTIC, GRASS_options, GRASS_init, GRASS_reset,
  1065.            GRASS_text, null_scale, GRASS_graphics, GRASS_move, GRASS_vector,
  1066.            GRASS_linetype, GRASS_put_text, GRASS_text_angle,
  1067.            GRASS_justify_text, GRASS_point, GRASS_arrow}
  1068. #endif
  1069.  
  1070. #ifdef HP26
  1071.     ,{"hp2623A", "HP2623A and maybe others",
  1072.        HP26_XMAX, HP26_YMAX, HP26_VCHAR, HP26_HCHAR,
  1073.        HP26_VTIC, HP26_HTIC, options_null, HP26_init, HP26_reset,
  1074.        HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
  1075.        HP26_linetype, HP26_put_text, HP26_text_angle, 
  1076.        null_justify_text, HP26_line_and_point, do_arrow}
  1077. #endif
  1078.  
  1079. #ifdef HP2648
  1080.     ,{"hp2648", "HP2648 and HP2647",
  1081.        HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
  1082.        HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
  1083.        HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
  1084.        HP2648linetype, HP2648put_text, HP2648_text_angle, 
  1085.        null_justify_text, line_and_point, do_arrow}
  1086. #endif
  1087.  
  1088. #ifdef HP75
  1089.     ,{"hp7580B", "HP7580, and probably other HPs (4 pens)",
  1090.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1091.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1092.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1093.        HP75_linetype, HPGL_put_text, HPGL_text_angle, 
  1094.        null_justify_text, do_point, do_arrow}
  1095. #endif
  1096.  
  1097. #ifdef HP500C
  1098.       ,{"hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
  1099.        HP500C_75PPI_XMAX, HP500C_75PPI_YMAX, HP500C_75PPI_VCHAR,
  1100.        HP500C_75PPI_HCHAR, HP500C_75PPI_VTIC, HP500C_75PPI_HTIC, HP500Coptions,
  1101.        HP500Cinit, HP500Creset, HP500Ctext, null_scale,
  1102.        HP500Cgraphics, HP500Cmove, HP500Cvector, HP500Clinetype,
  1103.        HP500Cput_text, HP500Ctext_angle, null_justify_text, do_point,
  1104.        do_arrow}
  1105. #endif
  1106.  
  1107. #ifdef HPGL
  1108.     ,{"hpgl", "HP7475 and (hopefully) lots of others (6 pens)",
  1109.        HPGL_XMAX, HPGL_YMAX, HPGL_VCHAR, HPGL_HCHAR,
  1110.        HPGL_VTIC, HPGL_HTIC, options_null, HPGL_init, HPGL_reset,
  1111.        HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
  1112.        HPGL_linetype, HPGL_put_text, HPGL_text_angle, 
  1113.        null_justify_text, do_point, do_arrow}
  1114. #endif
  1115.  
  1116. #ifdef HPLJII
  1117.     ,{"hpljii", "HP Laserjet series II, [75 100 150 300]",
  1118.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1119.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1120.        HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
  1121.        HPLJIIgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1122.        HPLJIIput_text, HPLJIItext_angle, null_justify_text, line_and_point,
  1123.        do_arrow}
  1124.     ,{"hpdj", "HP DeskJet 500, [75 100 150 300]",
  1125.        HPLJII_75PPI_XMAX, HPLJII_75PPI_YMAX, HPLJII_75PPI_VCHAR,
  1126.        HPLJII_75PPI_HCHAR, HPLJII_75PPI_VTIC, HPLJII_75PPI_HTIC, HPLJIIoptions,
  1127.        HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
  1128.        HPDJgraphics, HPLJIImove, HPLJIIvector, HPLJIIlinetype,
  1129.        HPDJput_text, HPDJtext_angle, null_justify_text, line_and_point,
  1130.        do_arrow}
  1131. #endif
  1132.  
  1133. #ifdef HPPJ
  1134.     ,{"hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
  1135.        HPPJ_XMAX, HPPJ_YMAX,
  1136.        HPPJ_9x17_VCHAR, HPPJ_9x17_HCHAR, HPPJ_9x17_VTIC, HPPJ_9x17_HTIC,
  1137.        HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
  1138.        HPPJmove, HPPJvector, HPPJlinetype, HPPJput_text, HPPJtext_angle,
  1139.        null_justify_text, do_point, do_arrow}
  1140. #endif
  1141.  
  1142. #ifdef IMAGEN
  1143.     ,{"imagen", "Imagen laser printer",
  1144.        IMAGEN_XMAX, IMAGEN_YMAX, IMAGEN_VCHAR, IMAGEN_HCHAR, 
  1145.        IMAGEN_VTIC, IMAGEN_HTIC, options_null, IMAGEN_init, IMAGEN_reset, 
  1146.        IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move, 
  1147.        IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
  1148.        IMAGEN_justify_text, line_and_point, do_arrow}
  1149. #endif
  1150.  
  1151. #ifdef IRIS4D
  1152.     ,{"iris4d", "Silicon Graphics IRIS 4D Series Computer",
  1153.        IRIS4D_XMAX, IRIS4D_YMAX, IRIS4D_VCHAR, IRIS4D_HCHAR, 
  1154.        IRIS4D_VTIC, IRIS4D_HTIC, IRIS4D_options, IRIS4D_init, IRIS4D_reset, 
  1155.        IRIS4D_text, null_scale, IRIS4D_graphics, IRIS4D_move, IRIS4D_vector,
  1156.        IRIS4D_linetype, IRIS4D_put_text, null_text_angle, 
  1157.        null_justify_text, do_point, do_arrow}
  1158. #endif
  1159.  
  1160. #ifdef KERMIT
  1161.     ,{"kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
  1162.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1163.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1164.        KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1165.        KTEK40Clinetype, TEK40put_text, null_text_angle, 
  1166.        null_justify_text, do_point, do_arrow}
  1167.     ,{"km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
  1168.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, KTEK40HCHAR, 
  1169.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, KTEK40reset, 
  1170.        TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector, 
  1171.        KTEK40Mlinetype, TEK40put_text, null_text_angle, 
  1172.        null_justify_text, line_and_point, do_arrow}
  1173. #endif
  1174.  
  1175. #ifdef LATEX
  1176.     ,{"latex", "LaTeX picture environment",
  1177.        LATEX_XMAX, LATEX_YMAX, LATEX_VCHAR, LATEX_HCHAR, 
  1178.        LATEX_VTIC, LATEX_HTIC, LATEX_options, LATEX_init, LATEX_reset, 
  1179.        LATEX_text, LATEX_scale, LATEX_graphics, LATEX_move, LATEX_vector, 
  1180.        LATEX_linetype, LATEX_put_text, LATEX_text_angle, 
  1181.        LATEX_justify_text, LATEX_point, LATEX_arrow}
  1182. #endif
  1183.  
  1184. #ifdef LN03P
  1185.      ,{"ln03", "LN03-plus laser printer in tektronix (EGM) mode",
  1186.     LN03PXMAX, LN03PYMAX, LN03PVCHAR, LN03PHCHAR,
  1187.     LN03PVTIC, LN03PHTIC, options_null, LN03Pinit, LN03Preset,
  1188.     LN03Ptext, null_scale, TEK40graphics, LN03Pmove, LN03Pvector,
  1189.     LN03Plinetype, LN03Pput_text, null_text_angle,
  1190.     null_justify_text, line_and_point, do_arrow}
  1191. #endif
  1192.  
  1193. #ifdef MF
  1194.     ,{"mf", "Metafont plotting standard",
  1195.        MF_XMAX, MF_YMAX, MF_VCHAR, MF_HCHAR, 
  1196.        MF_VTIC, MF_HTIC, options_null, MF_init, MF_reset, 
  1197.        MF_text, MF_scale, MF_graphics, MF_move, MF_vector, 
  1198.        MF_linetype, MF_put_text, MF_text_angle, 
  1199.        MF_justify_text, line_and_point, MF_arrow}
  1200. #endif
  1201.  
  1202. #ifdef MGR
  1203.     ,{"mgr", "Mgr window system",
  1204.     /* dimensions nominal, replaced during MGR_graphics call */
  1205.        MGR_XMAX, MGR_YMAX, MGR_VCHAR, MGR_HCHAR, 
  1206.        MGR_VTIC, MGR_HTIC, options_null, MGR_init, MGR_reset, 
  1207.        MGR_text, null_scale, MGR_graphics, MGR_move, MGR_vector,
  1208.        MGR_linetype, MGR_put_text, null_text_angle, 
  1209.        null_justify_text, do_point, do_arrow}
  1210. #endif
  1211.  
  1212. #ifdef MIF
  1213.     ,{"mif", "Frame maker MIF 3.00 format",
  1214.           MIF_XMAX, MIF_YMAX, MIF_VCHAR, MIF_HCHAR, 
  1215.          MIF_VTIC, MIF_HTIC, MIF_options, MIF_init, MIF_reset, 
  1216.         MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector, 
  1217.         MIF_linetype, MIF_put_text, MIF_text_angle, 
  1218.         MIF_justify_text, line_and_point, do_arrow}
  1219. #endif
  1220.  
  1221. #ifdef NEC
  1222.     ,{"nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
  1223.        NECXMAX, NECYMAX, NECVCHAR, NECHCHAR, 
  1224.        NECVTIC, NECHTIC, NECoptions, NECinit, NECreset, 
  1225.        NECtext, null_scale, NECgraphics, NECmove, NECvector, 
  1226.        NEClinetype, NECput_text, NEC_text_angle, 
  1227.        null_justify_text, line_and_point, do_arrow}
  1228. #endif
  1229.  
  1230. #ifdef NEXT
  1231.     ,{"next", "NeXTstep window system",
  1232.        NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR, 
  1233.        NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset, 
  1234.        NEXT_text, do_scale, NEXT_graphics, NEXT_move, NEXT_vector, 
  1235.        NEXT_linetype, NEXT_put_text, NEXT_text_angle, 
  1236.        NEXT_justify_text, NEXT_point, do_arrow}
  1237. #endif /* The PostScript driver with NXImage displaying the PostScript on screen */
  1238.  
  1239. #ifdef OKIDATA
  1240.     ,{"okidata", "OKIDATA 320/321 Standard",
  1241.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1242.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1243.        OKIDATAtext, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1244.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1245.        null_justify_text, do_point, do_arrow}
  1246. #endif
  1247.  
  1248. #ifdef OS2PM
  1249.     ,{"pm", "OS/2 Presentation Manager",
  1250.        PM_XMAX, PM_YMAX, PM_VCHAR, PM_HCHAR, 
  1251.        PM_VTIC, PM_HTIC, PM_args, PM_init, PM_reset, 
  1252.        PM_text, null_scale, PM_graphics, PM_move, PM_vector,
  1253.        PM_linetype, PM_put_text, PM_text_angle, 
  1254.        PM_justify_text, PM_point, do_arrow}
  1255. #endif
  1256.  
  1257. #ifdef PBM
  1258.     ,{"pbm", "Portable bitmap [small medium large] [monochrome gray color]",
  1259.        PBM_XMAX, PBM_YMAX, PBM_VCHAR,
  1260.        PBM_HCHAR, PBM_VTIC, PBM_HTIC, PBMoptions,
  1261.        PBMinit, PBMreset, PBMtext, null_scale,
  1262.        PBMgraphics, PBMmove, PBMvector, PBMlinetype,
  1263.        PBMput_text, PBMtext_angle, null_justify_text, PBMpoint,
  1264.        do_arrow}
  1265. #endif
  1266.  
  1267. #ifdef PCL
  1268.  ,{"pcl5", "HP LaserJet III [mode] [font] [point]",
  1269.    PCL_XMAX, PCL_YMAX, HPGL2_VCHAR, HPGL2_HCHAR,
  1270.    PCL_VTIC, PCL_HTIC, PCL_options, PCL_init, PCL_reset,
  1271.    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
  1272.    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
  1273.    HPGL2_justify_text, do_point, do_arrow}
  1274. #endif
  1275.  
  1276. #ifdef POSTSCRIPT
  1277.     ,{"postscript", "PostScript graphics language [mode \042fontname\042 font_size]",
  1278.        PS_XMAX, PS_YMAX, PS_VCHAR, PS_HCHAR, 
  1279.        PS_VTIC, PS_HTIC, PS_options, PS_init, PS_reset, 
  1280.        PS_text, null_scale, PS_graphics, PS_move, PS_vector, 
  1281.        PS_linetype, PS_put_text, PS_text_angle, 
  1282.        PS_justify_text, PS_point, do_arrow}
  1283. #endif
  1284.  
  1285. #ifdef PRESCRIBE
  1286.     ,{"prescribe", "Prescribe - for the Kyocera Laser Printer",
  1287.     PRE_XMAX, PRE_YMAX, PRE_VCHAR, PRE_HCHAR, 
  1288.     PRE_VTIC, PRE_HTIC, options_null, PRE_init, PRE_reset, 
  1289.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1290.     PRE_linetype, PRE_put_text, null_text_angle, 
  1291.     PRE_justify_text, line_and_point, do_arrow}
  1292.     ,{"kyo", "Kyocera Laser Printer with Courier font",
  1293.     PRE_XMAX, PRE_YMAX, KYO_VCHAR, KYO_HCHAR, 
  1294.     PRE_VTIC, PRE_HTIC, options_null, KYO_init, PRE_reset, 
  1295.     PRE_text, null_scale, PRE_graphics, PRE_move, PRE_vector, 
  1296.     PRE_linetype, PRE_put_text, null_text_angle, 
  1297.     PRE_justify_text, line_and_point, do_arrow}
  1298. #endif /* PRESCRIBE */
  1299.  
  1300. #ifdef PSLATEX
  1301.     ,{"pslatex", "LaTeX picture environment with PostScript \\specials",
  1302.     PS_XMAX, PS_YMAX, PSLATEX_VCHAR, PSLATEX_HCHAR,
  1303.     PS_VTIC, PS_HTIC, PSLATEX_options, PSLATEX_init, PSLATEX_reset,
  1304.     PSLATEX_text, PSLATEX_scale, PSLATEX_graphics, PS_move, PS_vector,
  1305.     PS_linetype, PSLATEX_put_text, PSLATEX_text_angle,
  1306.     PSLATEX_justify_text, PS_point, do_arrow}
  1307. #endif
  1308.  
  1309. #ifdef    PSTRICKS
  1310.     ,{"pstricks", "LaTeX picture environment with PSTricks macros",
  1311.        PSTRICKS_XMAX, PSTRICKS_YMAX, PSTRICKS_VCHAR, PSTRICKS_HCHAR, 
  1312.        PSTRICKS_VTIC, PSTRICKS_HTIC, options_null, PSTRICKS_init, PSTRICKS_reset, 
  1313.        PSTRICKS_text, PSTRICKS_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector, 
  1314.        PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle, 
  1315.        PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow}
  1316. #endif
  1317.     
  1318. #ifdef QMS
  1319.     ,{"qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
  1320.        QMS_XMAX,QMS_YMAX, QMS_VCHAR, QMS_HCHAR, 
  1321.        QMS_VTIC, QMS_HTIC, options_null, QMS_init,QMS_reset, 
  1322.        QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
  1323.        QMS_linetype,QMS_put_text, null_text_angle, 
  1324.        null_justify_text, line_and_point, do_arrow}
  1325. #endif
  1326.  
  1327. #ifdef REGIS
  1328.     ,{"regis", "REGIS graphics language",
  1329.        REGISXMAX, REGISYMAX, REGISVCHAR, REGISHCHAR, 
  1330.        REGISVTIC, REGISHTIC, REGISoptions, REGISinit, REGISreset, 
  1331.        REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
  1332.        REGISlinetype, REGISput_text, REGIStext_angle, 
  1333.        null_justify_text, line_and_point, do_arrow}
  1334. #endif
  1335.  
  1336. #ifdef RGIP
  1337.     ,{"rgip", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1338.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1339.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1340.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1341.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1342.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1343.     ,{"uniplex", "RGIP metafile (Uniplex). Option: fontsize (1-8)",
  1344.        RGIP_XMAX, RGIP_YMAX, RGIP_VCHAR, RGIP_HCHAR,
  1345.        RGIP_VTIC, RGIP_HTIC, RGIP_options, RGIP_init, RGIP_reset,
  1346.        RGIP_text, null_scale, RGIP_graphics, RGIP_move,
  1347.        RGIP_vector, RGIP_linetype, RGIP_put_text, RGIP_text_angle,
  1348.        RGIP_justify_text, RGIP_do_point, do_arrow}
  1349. #endif
  1350.  
  1351. #ifdef SELANAR
  1352.     ,{"selanar", "Selanar",
  1353.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1354.        TEK40VTIC, TEK40HTIC, options_null, SEL_init, SEL_reset, 
  1355.        SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector, 
  1356.        TEK40linetype, TEK40put_text, null_text_angle, 
  1357.        null_justify_text, line_and_point, do_arrow}
  1358. #endif
  1359.  
  1360. #ifdef STARC
  1361.     ,{"starc", "Star Color Printer",
  1362.        STARCXMAX, STARCYMAX, STARCVCHAR, STARCHCHAR, 
  1363.        STARCVTIC, STARCHTIC, options_null, STARCinit, STARCreset, 
  1364.        STARCtext, null_scale, STARCgraphics, STARCmove, STARCvector, 
  1365.        STARClinetype, STARCput_text, STARC_text_angle, 
  1366.        null_justify_text, line_and_point, do_arrow}
  1367. #endif
  1368.  
  1369. #ifdef SUN
  1370.     ,{"sun", "SunView window system",
  1371.        SUN_XMAX, SUN_YMAX, SUN_VCHAR, SUN_HCHAR, 
  1372.        SUN_VTIC, SUN_HTIC, options_null, SUN_init, SUN_reset, 
  1373.        SUN_text, null_scale, SUN_graphics, SUN_move, SUN_vector,
  1374.        SUN_linetype, SUN_put_text, null_text_angle, 
  1375.        SUN_justify_text, line_and_point, do_arrow}
  1376. #endif
  1377.  
  1378. #ifdef VWS
  1379.     ,{"VWS", "VAX Windowing System (UIS)",
  1380.            VWS_XMAX, VWS_YMAX, VWS_VCHAR, VWS_HCHAR,
  1381.            VWS_VTIC, VWS_HTIC, options_null, VWS_init, VWS_reset,
  1382.            VWS_text, null_scale, VWS_graphics, VWS_move, VWS_vector,
  1383.            VWS_linetype, VWS_put_text, VWS_text_angle,
  1384.            VWS_justify_text, do_point, do_arrow}
  1385. #endif
  1386.  
  1387. #ifdef TANDY60
  1388.     ,{"tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
  1389.        EPS60XMAX, EPS60YMAX, EPSONVCHAR, EPSONHCHAR,
  1390.        EPSONVTIC, EPSONHTIC, options_null, EPSONinit, EPSONreset,
  1391.        TANDY60text, null_scale, EPS60graphics, EPSONmove, EPSONvector,
  1392.        EPSONlinetype, EPSONput_text, EPSON_text_angle,
  1393.        null_justify_text, do_point, do_arrow}
  1394. #endif
  1395.  
  1396. #ifdef T410X
  1397.     ,{"tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
  1398.        T410XXMAX, T410XYMAX, T410XVCHAR, T410XHCHAR, 
  1399.        T410XVTIC, T410XHTIC, options_null, T410X_init, T410X_reset, 
  1400.        T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector, 
  1401.        T410X_linetype, T410X_put_text, T410X_text_angle, 
  1402.        null_justify_text, T410X_point, do_arrow}
  1403. #endif
  1404.  
  1405. #ifdef TEK
  1406.     ,{"tek40xx", "Tektronix 4010 and others; most TEK emulators",
  1407.        TEK40XMAX, TEK40YMAX, TEK40VCHAR, TEK40HCHAR, 
  1408.        TEK40VTIC, TEK40HTIC, options_null, TEK40init, TEK40reset, 
  1409.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector, 
  1410.        TEK40linetype, TEK40put_text, null_text_angle, 
  1411.        null_justify_text, line_and_point, do_arrow}
  1412. #endif
  1413.  
  1414. #ifdef TEXDRAW
  1415.     ,{"texdraw", "LaTeX texdraw environment",
  1416.        TEXDRAW_XMAX, TEXDRAW_YMAX, TEXDRAW_VCHAR, TEXDRAW_HCHAR,
  1417.     TEXDRAW_VTIC, TEXDRAW_HTIC, options_null, TEXDRAW_init, TEXDRAW_reset,
  1418.     TEXDRAW_text, TEXDRAW_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
  1419.     TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
  1420.     TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow}
  1421. #endif
  1422.   
  1423. #ifdef TGIF
  1424.     ,{"tgif", "TGIF X-Window draw tool (file version 10)",
  1425.        TGIF_XMAX, TGIF_YMAX, TGIF_VCHAR1, TGIF_HCHAR1, 
  1426.        TGIF_VTIC, TGIF_HTIC, options_null, TGIF_init, TGIF_reset, 
  1427.        TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector, 
  1428.        TGIF_linetype, TGIF_put_text, TGIF_text_angle, 
  1429.        TGIF_justify_text, line_and_point, TGIF_arrow}
  1430. #endif
  1431.  
  1432. #ifdef TPIC
  1433.     ,{"tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
  1434.        TPIC_XMAX, TPIC_YMAX, TPIC_VCHAR, TPIC_HCHAR, 
  1435.        TPIC_VTIC, TPIC_HTIC, TPIC_options, TPIC_init, TPIC_reset, 
  1436.        TPIC_text, TPIC_scale, TPIC_graphics, TPIC_move, TPIC_vector, 
  1437.        TPIC_linetype, TPIC_put_text, TPIC_text_angle, 
  1438.        TPIC_justify_text, TPIC_point, TPIC_arrow}
  1439. #endif
  1440.  
  1441. #ifdef UNIXPLOT
  1442. #ifdef GNUGRAPH
  1443.     ,{"unixplot", "GNU plot(1) format [\042fontname\042 font_size]",
  1444.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR,
  1445.        UP_VTIC, UP_HTIC, UP_options, UP_init, UP_reset,
  1446.        UP_text, null_scale, UP_graphics, UP_move, UP_vector,
  1447.        UP_linetype, UP_put_text, UP_text_angle,
  1448.        UP_justify_text, line_and_point, do_arrow}
  1449. #else
  1450.     ,{"unixplot", "Unix plotting standard (see plot(1))",
  1451.        UP_XMAX, UP_YMAX, UP_VCHAR, UP_HCHAR, 
  1452.        UP_VTIC, UP_HTIC, options_null, UP_init, UP_reset, 
  1453.        UP_text, null_scale, UP_graphics, UP_move, UP_vector, 
  1454.        UP_linetype, UP_put_text, null_text_angle, 
  1455.        null_justify_text, line_and_point, do_arrow}
  1456. #endif /* GNUGRAPH */
  1457. #endif
  1458.     
  1459. #ifdef UNIXPC
  1460.     ,{"unixpc", "AT&T 3b1 or AT&T 7300 Unix PC",
  1461.        uPC_XMAX, uPC_YMAX, uPC_VCHAR, uPC_HCHAR, 
  1462.        uPC_VTIC, uPC_HTIC, options_null, uPC_init, uPC_reset, 
  1463.        uPC_text, null_scale, uPC_graphics, uPC_move, uPC_vector,
  1464.        uPC_linetype, uPC_put_text, uPC_text_angle, 
  1465.        null_justify_text, line_and_point, do_arrow}
  1466. #endif
  1467.  
  1468. #ifdef EMXVGA
  1469. #ifdef EMXVESA
  1470.     ,{"vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
  1471.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1472.        EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
  1473.        EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
  1474.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1475.        null_justify_text, do_point, do_arrow}
  1476. #endif
  1477.     ,{"vgal", "IBM PC/Clone with VGA graphics board",
  1478.        EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
  1479.        EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
  1480.        EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
  1481.        EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle, 
  1482.        null_justify_text, do_point, do_arrow}
  1483. #endif
  1484.  
  1485. #ifdef V384
  1486.     ,{"vx384", "Vectrix 384 and Tandy color printer",
  1487.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  1488.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  1489.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  1490.        V384_linetype, V384_put_text, null_text_angle, 
  1491.        null_justify_text, do_point, do_arrow}
  1492. #endif
  1493.  
  1494. #ifdef VTTEK
  1495.     ,{"vttek", "VT-like tek40xx terminal emulator",
  1496.        TEK40XMAX,TEK40YMAX,TEK40VCHAR, TEK40HCHAR,
  1497.        TEK40VTIC, TEK40HTIC, options_null, VTTEK40init, VTTEK40reset,
  1498.        TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
  1499.        VTTEK40linetype, VTTEK40put_text, null_text_angle,
  1500.        null_justify_text, line_and_point, do_arrow}
  1501. #endif
  1502.  
  1503. #ifdef _Windows
  1504.     ,{"windows", "Microsoft Windows",
  1505.        WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR, 
  1506.        WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset, 
  1507.        WIN_text, WIN_scale, WIN_graphics, WIN_move, WIN_vector,
  1508.        WIN_linetype, WIN_put_text, WIN_text_angle, 
  1509.        WIN_justify_text, WIN_point, do_arrow}
  1510. #endif
  1511.  
  1512. #ifdef X11
  1513.     ,{"x11", "X11 Window System",
  1514.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1515.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1516.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1517.        X11_linetype, X11_put_text, null_text_angle, 
  1518.        X11_justify_text, X11_point, do_arrow}
  1519.     ,{"X11", "X11 Window System (identical to x11)",
  1520.        X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR, 
  1521.        X11_VTIC, X11_HTIC, options_null, X11_init, X11_reset, 
  1522.        X11_text, null_scale, X11_graphics, X11_move, X11_vector, 
  1523.        X11_linetype, X11_put_text, null_text_angle, 
  1524.        X11_justify_text, X11_point, do_arrow}
  1525.    ,{"xlib", "X11 Window System (gnulib_x11 dump)",
  1526.        Xlib_XMAX, Xlib_YMAX, Xlib_VCHAR, Xlib_HCHAR, 
  1527.        Xlib_VTIC, Xlib_HTIC, options_null, Xlib_init, Xlib_reset, 
  1528.        Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector, 
  1529.        Xlib_linetype, Xlib_put_text, null_text_angle, 
  1530.        Xlib_justify_text, line_and_point, do_arrow}
  1531. #endif
  1532. };
  1533.  
  1534. #define TERMCOUNT (sizeof(term_tbl)/sizeof(struct termentry))
  1535.  
  1536.  
  1537. list_terms()
  1538. {
  1539. register int i;
  1540.  
  1541.     fprintf(stderr,"\nAvailable terminal types:\n");
  1542.     for (i = 0; i < TERMCOUNT; i++)
  1543.         fprintf(stderr,"  %15s  %s\n",
  1544.                term_tbl[i].name, term_tbl[i].description);
  1545.     (void) putc('\n',stderr);
  1546. }
  1547.  
  1548.  
  1549. /* set_term: get terminal number from name on command line */
  1550. /* will change 'term' variable if successful */
  1551. int                        /* term number */
  1552. set_term(c_token)
  1553. int c_token;
  1554. {
  1555.     register int t;
  1556.     char *input_name;
  1557.  
  1558.     if (!token[c_token].is_token)
  1559.      int_error("terminal name expected",c_token);
  1560.     t = -1;
  1561.     input_name = input_line + token[c_token].start_index;
  1562.     t = change_term(input_name, token[c_token].length);
  1563.     if (t == -1)
  1564.      int_error("unknown terminal type; type just 'set terminal' for a list",
  1565.              c_token);
  1566.     if (t == -2)
  1567.      int_error("ambiguous terminal name; type just 'set terminal' for a list",
  1568.              c_token);
  1569.  
  1570.     /* otherwise the type was changed */
  1571.  
  1572.     return(t);
  1573. }
  1574.  
  1575. /* change_term: get terminal number from name and set terminal type */
  1576. /* returns -1 if unknown, -2 if ambiguous, >=0 is terminal number */
  1577. int
  1578. change_term(name, length)
  1579.     char *name;
  1580.     int length;
  1581. {
  1582.     int i, t = -1;
  1583.  
  1584.     for (i = 0; i < TERMCOUNT; i++) {
  1585.        if (!strncmp(name,term_tbl[i].name,length)) {
  1586.           if (t != -1)
  1587.             return(-2);    /* ambiguous */
  1588.           t = i;
  1589.        }
  1590.     }
  1591.  
  1592.     if (t == -1)            /* unknown */
  1593.      return(t);
  1594.  
  1595.     /* Success: set terminal type now */
  1596.  
  1597.     term = t;
  1598.     term_init = FALSE;
  1599.     name = term_tbl[term].name;
  1600.  
  1601.     /* Special handling for unixplot term type */
  1602.     if (!strncmp("unixplot",name,8)) {
  1603.        UP_redirect (2);  /* Redirect actual stdout for unixplots */
  1604.     } else if (unixplot) {
  1605.        UP_redirect (3);  /* Put stdout back together again. */
  1606.     }
  1607.  
  1608.     if (interactive)
  1609.      fprintf(stderr, "Terminal type set to '%s'\n", name);
  1610.  
  1611.     return(t);
  1612. }
  1613.  
  1614. /*
  1615.    Routine to detect what terminal is being used (or do anything else
  1616.    that would be nice).  One anticipated (or allowed for) side effect
  1617.    is that the global ``term'' may be set. 
  1618.    The environment variable GNUTERM is checked first; if that does
  1619.    not exist, then the terminal hardware is checked, if possible, 
  1620.    and finally, we can check $TERM for some kinds of terminals.
  1621.    A default can be set with -DDEFAULTTERM=myterm in the Makefile
  1622.    or #define DEFAULTTERM myterm in term.h
  1623. */
  1624. /* thanks to osupyr!alden (Dave Alden) for the original GNUTERM code */
  1625. init_terminal()
  1626. {
  1627.     int t;
  1628. #ifdef DEFAULTTERM
  1629.     char *term_name = DEFAULTTERM;
  1630. #else
  1631.     char *term_name = NULL;
  1632. #endif /* DEFAULTTERM */
  1633. #if (defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)) || defined(NEXT) || defined(SUN) || defined(X11)
  1634.     char *term = NULL;        /* from TERM environment var */
  1635. #endif
  1636. #ifdef X11
  1637.     char *display = NULL;
  1638. #endif
  1639.     char *gnuterm = NULL;
  1640.  
  1641.     /* GNUTERM environment variable is primary */
  1642.     gnuterm = getenv("GNUTERM");
  1643.     if (gnuterm != (char *)NULL) {
  1644.      term_name = gnuterm;
  1645. #ifndef _Windows
  1646. #if defined(__TURBOC__) && defined(MSDOS)
  1647.          get_path();   /* So *_init() can find the BGI driver */
  1648. # endif
  1649. #endif
  1650.     }
  1651.     else {
  1652. #if defined(__TURBOC__) && defined(MSDOS) && !defined(_Windows)
  1653.        term_name = turboc_init();
  1654.        term = (char *)NULL; /* shut up turbo C */
  1655. #endif
  1656.        
  1657. #ifdef __ZTC__
  1658.       term_name = ztc_init();
  1659. #endif
  1660.  
  1661. #ifdef vms
  1662.        term_name = vms_init();
  1663. #endif
  1664.  
  1665. #ifdef NEXT
  1666.     term = getenv("TERM");
  1667.     if (term_name == (char *)NULL
  1668.         && term != (char *)NULL && strcmp(term,"next") == 0)
  1669.           term_name = "next";
  1670. #endif /* NeXT */
  1671.        
  1672. #ifdef SUN
  1673.        term = getenv("TERM");    /* try $TERM */
  1674.        if (term_name == (char *)NULL
  1675.           && term != (char *)NULL && strcmp(term, "sun") == 0)
  1676.         term_name = "sun";
  1677. #endif /* sun */
  1678.  
  1679. #ifdef _Windows
  1680.         term_name = "win";
  1681. #endif /* _Windows */
  1682.  
  1683. #ifdef GPR
  1684.    if (gpr_isa_pad()) term_name = "gpr";       /* find out whether stdout is a DM pad. See term/gpr.trm */
  1685. #else
  1686. #ifdef APOLLO
  1687.    if (apollo_isa_pad()) term_name = "apollo"; /* find out whether stdout is a DM pad. See term/apollo.trm */
  1688. #endif /* APOLLO */
  1689. #endif /* GPR    */
  1690.  
  1691. #ifdef X11
  1692.        term = getenv("TERM");    /* try $TERM */
  1693.        if (term_name == (char *)NULL
  1694.           && term != (char *)NULL && strcmp(term, "xterm") == 0)
  1695.         term_name = "x11";
  1696.        display = getenv("DISPLAY");
  1697.        if (term_name == (char *)NULL && display != (char *)NULL)
  1698.         term_name = "x11";
  1699.        if (X11_Display)
  1700.         term_name = "x11";
  1701. #endif /* x11 */
  1702.  
  1703. #ifdef AMIGASCREEN
  1704.        term_name = "amiga";
  1705. #endif
  1706.  
  1707. #ifdef ATARI
  1708.        term_name = "atari";
  1709. #endif
  1710.  
  1711. #ifdef UNIXPC
  1712.            if (iswind() == 0) {
  1713.               term_name = "unixpc";
  1714.            }
  1715. #endif /* unixpc */
  1716.  
  1717. #ifdef CGI
  1718.        if (getenv("CGIDISP") || getenv("CGIPRNT"))
  1719.          term_name = "cgi";
  1720. #endif /*CGI */
  1721.  
  1722. #if defined(MSDOS) && defined(__EMX__)
  1723. #ifdef EMXVESA
  1724.        term_name = "vesa";
  1725. #else
  1726.        term_name = "vgal";
  1727. #endif
  1728. #endif
  1729.  
  1730. #ifdef DJGPP
  1731.         term_name = "svga";
  1732. #endif
  1733.  
  1734. #ifdef GRASS
  1735.         term_name = "grass";
  1736. #endif
  1737.  
  1738. #ifdef OS2
  1739.            term_name = "pm" ;
  1740.             /* EMX compiler has getcwd that can return drive */
  1741.            if( PM_path[0]=='\0' ) _getcwd2( PM_path, 256 ) ;
  1742. #endif /*OS2 */           
  1743.     }
  1744.  
  1745.     /* We have a name, try to set term type */
  1746.     if (term_name != NULL && *term_name != '\0') {
  1747.        t = change_term(term_name, (int)strlen(term_name));
  1748.        if (t == -1)
  1749.         fprintf(stderr, "Unknown terminal name '%s'\n", term_name);
  1750.        else if (t == -2)
  1751.         fprintf(stderr, "Ambiguous terminal name '%s'\n", term_name);
  1752.        else                /* successful */
  1753.         ;
  1754.     }
  1755. }
  1756.  
  1757.  
  1758. #ifndef _Windows
  1759. #if defined (__TURBOC__) && defined (MSDOS)
  1760. char *
  1761. turboc_init()
  1762. {
  1763.   int g_driver,g_mode;
  1764.   char far *c1,*c2;
  1765.   char *term_name = NULL;
  1766.   struct text_info tinfo;       /* So we can restore starting text mode. */
  1767.  
  1768. /* Some of this code including BGI drivers is copyright Borland Intl. */
  1769.     g_driver=DETECT;
  1770.           get_path();
  1771.     gettextinfo(&tinfo);
  1772.         initgraph(&g_driver,&g_mode,path);
  1773.         c1=getdrivername();
  1774.         c2=getmodename(g_mode);
  1775.           switch (g_driver){
  1776.             case -2: fprintf(stderr,"Graphics card not detected.\n");
  1777.                      break;
  1778.             case -3: fprintf(stderr,"BGI driver file cannot be found.\n");
  1779.                      break;
  1780.             case -4: fprintf(stderr,"Invalid BGI driver file.\n");
  1781.                      break;
  1782.             case -5: fprintf(stderr,"Insufficient memory to load ",
  1783.                              "graphics driver.");
  1784.                      break;
  1785.             case 1 : term_name = "cga";
  1786.                      break;
  1787.             case 2 : term_name = "mcga";
  1788.                      break;
  1789.             case 3 : 
  1790.             case 4 : term_name = "egalib";
  1791.                      break;
  1792.             case 7 : term_name = "hercules";
  1793.                      break;
  1794.             case 8 : term_name = "att";
  1795.                      break;
  1796.             case 9 : term_name = "vgalib";
  1797.                      break;
  1798.             }
  1799.         closegraph();
  1800.         textmode(tinfo.currmode);
  1801.     clrscr();
  1802.     fprintf(stderr,"\tTC Graphics, driver %s  mode %s\n",c1,c2);
  1803.   return(term_name);
  1804. }
  1805. # endif /* __TURBOC__ */
  1806. #endif
  1807.  
  1808. #if defined(__ZTC__)
  1809. char *
  1810. ztc_init()
  1811. {
  1812.   int g_mode;
  1813.   char *term_name = NULL;
  1814.  
  1815.     g_mode = fg_init();
  1816.  
  1817.           switch (g_mode){
  1818.             case FG_NULL      :  fprintf(stderr,"Graphics card not detected or not supported.\n");
  1819.                                  exit(1);
  1820.             case FG_HERCFULL  :  term_name = "hercules";
  1821.                                  break;
  1822.             case FG_EGAMONO   :  term_name = "egamono";
  1823.                                  break;
  1824.             case FG_EGAECD      :  term_name = "egalib";
  1825.                                  break;
  1826.             case FG_VGA11      :  term_name = "vgamono";
  1827.                                  break;
  1828.             case FG_VGA12      :  term_name = "vgalib";
  1829.                                  break;
  1830.             case FG_VESA6A      :  term_name = "svgalib";
  1831.                                  break;
  1832.             case FG_VESA5      :  term_name = "ssvgalib";
  1833.                                  break;
  1834.             }
  1835.         fg_term();
  1836.   return(term_name);
  1837. }
  1838. #endif /* __ZTC__ */
  1839.  
  1840.  
  1841. /*
  1842.     This is always defined so we don't have to have command.c know if it
  1843.     is there or not.
  1844. */
  1845. #ifndef UNIXPLOT
  1846. UP_redirect(caller) int caller; 
  1847. {
  1848.     caller = caller;    /* to stop Turbo C complaining 
  1849.                          * about caller not being used */
  1850. }
  1851. #else
  1852. UP_redirect (caller)
  1853. int caller;
  1854. /*
  1855.     Unixplot can't really write to outfile--it wants to write to stdout.
  1856.     This is normally ok, but the original design of gnuplot gives us
  1857.     little choice.  Originally users of unixplot had to anticipate
  1858.     their needs and redirect all I/O to a file...  Not very gnuplot-like.
  1859.  
  1860.     caller:  1 - called from SET OUTPUT "FOO.OUT"
  1861.              2 - called from SET TERM UNIXPLOT
  1862.              3 - called from SET TERM other
  1863.              4 - called from SET OUTPUT
  1864. */
  1865. {
  1866.     switch (caller) {
  1867.     case 1:
  1868.     /* Don't save, just replace stdout w/outfile (save was already done). */
  1869.         if (unixplot)
  1870.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1871.     break;
  1872.     case 2:
  1873.         if (!unixplot) {
  1874.             fflush(stdout);
  1875.             save_stdout = *(stdout);
  1876.             *(stdout) = *(outfile);  /* Copy FILE structure */
  1877.             unixplot = 1;
  1878.         }
  1879.     break;
  1880.     case 3:
  1881.     /* New terminal in use--put stdout back to original. */
  1882.         /* closepl(); */  /* This is called by the term. */
  1883.         fflush(stdout);
  1884.         *(stdout) = save_stdout;  /* Copy FILE structure */
  1885.         unixplot = 0;
  1886.     break;
  1887.     case 4:
  1888.     /*  User really wants to go to normal output... */
  1889.         if (unixplot) {
  1890.             fflush(stdout);
  1891.             *(stdout) = save_stdout;  /* Copy FILE structure */
  1892.         }
  1893.     break;
  1894.     }
  1895. }
  1896. #endif
  1897.  
  1898.  
  1899. /* test terminal by drawing border and text */
  1900. /* called from command test */
  1901. test_term()
  1902. {
  1903.     register struct termentry *t = &term_tbl[term];
  1904.     char *str;
  1905.     int x,y, xl,yl, i;
  1906.     unsigned int xmax, ymax;
  1907.     char label[MAX_ID_LEN];
  1908.     int scaling;
  1909.  
  1910.     if (!term_init) {
  1911.        (*t->init)();
  1912.        term_init = TRUE;
  1913.     }
  1914.     screen_ok = FALSE;
  1915.     scaling = (*t->scale)(xsize, ysize);
  1916.     xmax = (unsigned int)(t->xmax * (scaling ? 1 : xsize));
  1917.     ymax = (unsigned int)(t->ymax * (scaling ? 1 : ysize));
  1918.     (*t->graphics)();
  1919.     /* border linetype */
  1920.     (*t->linetype)(-2);
  1921.     (*t->move)(0,0);
  1922.     (*t->vector)(xmax-1,0);
  1923.     (*t->vector)(xmax-1,ymax-1);
  1924.     (*t->vector)(0,ymax-1);
  1925.     (*t->vector)(0,0);
  1926.     (void) (*t->justify_text)(LEFT);
  1927.     (*t->put_text)(t->h_char*5,ymax-t->v_char*3,"Terminal Test");
  1928.     /* axis linetype */
  1929.     (*t->linetype)(-1);
  1930.     (*t->move)(xmax/2,0);
  1931.     (*t->vector)(xmax/2,ymax-1);
  1932.     (*t->move)(0,ymax/2);
  1933.     (*t->vector)(xmax-1,ymax/2);
  1934.     /* test width and height of characters */
  1935.     (*t->linetype)(-2);
  1936.     (*t->move)(  xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1937.     (*t->vector)(xmax/2+t->h_char*10,ymax/2+t->v_char/2);
  1938.     (*t->vector)(xmax/2+t->h_char*10,ymax/2-t->v_char/2);
  1939.     (*t->vector)(xmax/2-t->h_char*10,ymax/2-t->v_char/2);
  1940.     (*t->vector)(xmax/2-t->h_char*10,ymax/2+t->v_char/2);
  1941.     (*t->put_text)(xmax/2-t->h_char*10,ymax/2,
  1942.         "12345678901234567890");
  1943.     /* test justification */
  1944.     (void) (*t->justify_text)(LEFT);
  1945.     (*t->put_text)(xmax/2,ymax/2+t->v_char*6,"left justified");
  1946.     str = "centre+d text";
  1947.     if ((*t->justify_text)(CENTRE))
  1948.         (*t->put_text)(xmax/2,
  1949.                 ymax/2+t->v_char*5,str);
  1950.     else
  1951.         (*t->put_text)(xmax/2-strlen(str)*t->h_char/2,
  1952.                 ymax/2+t->v_char*5,str);
  1953.     str = "right justified";
  1954.     if ((*t->justify_text)(RIGHT))
  1955.         (*t->put_text)(xmax/2,
  1956.                 ymax/2+t->v_char*4,str);
  1957.     else
  1958.         (*t->put_text)(xmax/2-strlen(str)*t->h_char,
  1959.                 ymax/2+t->v_char*4,str);
  1960.     /* test text angle */
  1961.     str = "rotated ce+ntred text";
  1962.     if ((*t->text_angle)(1)) {
  1963.         if ((*t->justify_text)(CENTRE))
  1964.             (*t->put_text)(t->v_char,
  1965.                 ymax/2,str);
  1966.         else
  1967.             (*t->put_text)(t->v_char,
  1968.                 ymax/2-strlen(str)*t->h_char/2,str);
  1969.     }
  1970.     else {
  1971.         (void) (*t->justify_text)(LEFT);
  1972.         (*t->put_text)(t->h_char*2,ymax/2-t->v_char*2,"Can't rotate text");
  1973.     }
  1974.     (void) (*t->justify_text)(LEFT);
  1975.     (void) (*t->text_angle)(0);
  1976.     /* test tic size */
  1977.     (*t->move)(xmax/2+t->h_tic*2,0);
  1978.     (*t->vector)(xmax/2+t->h_tic*2,t->v_tic);
  1979.     (*t->move)(xmax/2,t->v_tic*2);
  1980.     (*t->vector)(xmax/2+t->h_tic,t->v_tic*2);
  1981.     (*t->put_text)(xmax/2+t->h_tic*2,t->v_tic*2+t->v_char/2,"test tics");
  1982.     /* test line and point types */
  1983.     x = xmax - t->h_char*4 - t->h_tic*4;
  1984.     y = ymax - t->v_char;
  1985.     for ( i = -2; y > t->v_char; i++ ) {
  1986.         (*t->linetype)(i);
  1987.         /*    (void) sprintf(label,"%d",i);  Jorgen Lippert
  1988.         lippert@risoe.dk */
  1989.         (void) sprintf(label,"%d",i+1);
  1990.         if ((*t->justify_text)(RIGHT))
  1991.             (*t->put_text)(x,y,label);
  1992.         else
  1993.             (*t->put_text)(x-strlen(label)*t->h_char,y,label);
  1994.         (*t->move)(x+t->h_char,y);
  1995.         (*t->vector)(x+t->h_char*4,y);
  1996.         if ( i >= -1 )
  1997.             (*t->point)(x+t->h_char*4+t->h_tic*2,y,i);
  1998.         y -= t->v_char;
  1999.     }
  2000.     /* test some arrows */
  2001.     (*t->linetype)(0);
  2002.     x = xmax/4;
  2003.     y = ymax/4;
  2004.     xl = t->h_tic*5;
  2005.     yl = t->v_tic*5;
  2006.     (*t->arrow)(x,y,x+xl,y,TRUE);
  2007.     (*t->arrow)(x,y,x+xl/2,y+yl,TRUE);
  2008.     (*t->arrow)(x,y,x,y+yl,TRUE);
  2009.     (*t->arrow)(x,y,x-xl/2,y+yl,FALSE);
  2010.     (*t->arrow)(x,y,x-xl,y,TRUE);
  2011.     (*t->arrow)(x,y,x-xl,y-yl,TRUE);
  2012.     (*t->arrow)(x,y,x,y-yl,TRUE);
  2013.     (*t->arrow)(x,y,x+xl,y-yl,TRUE);
  2014.     /* and back into text mode */
  2015.     (*t->text)();
  2016. }
  2017.  
  2018.  
  2019. #if defined(MSDOS)||defined(ATARI)||defined(OS2)||defined(_Windows)||defined(DOS386)
  2020. /* output for some terminal types must be binary to stop non Unix computers
  2021.    changing \n to \r\n. 
  2022.    If the output is not STDOUT, the following code reopens outfile 
  2023.    with binary mode. */
  2024. void
  2025. reopen_binary()
  2026. {
  2027. char filename[MAX_ID_LEN+1];
  2028.  
  2029.     if (outfile!=stdout) {
  2030.         (void) fclose(outfile);
  2031.         (void) strcpy(filename,outstr+1);    /* remove quotes */
  2032.         filename[strlen(filename)-1] = '\0';
  2033. #ifdef _Windows
  2034.         if ( !stricmp(outstr,"'PRN'") )
  2035.             (void) strcpy(filename,win_prntmp);    /* use temp file for windows */
  2036. #endif
  2037.         if ( (outfile = fopen(filename,"wb")) == (FILE *)NULL ) {
  2038.             if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2039.                 os_error("cannot reopen file with binary type; output unknown",
  2040.                     NO_CARET);
  2041.             } 
  2042.             else {
  2043.     os_error("cannot reopen file with binary type; output reset to ascii", 
  2044.                     NO_CARET);
  2045.             }
  2046.         }
  2047. #if defined(__TURBOC__) && defined(MSDOS)
  2048. #ifndef _Windows
  2049.         if ( !stricmp(outstr,"'PRN'") )
  2050.         {
  2051.         /* Put the printer into binary mode. */
  2052.         union REGS regs;
  2053.             regs.h.ah = 0x44;    /* ioctl */
  2054.             regs.h.al = 0;        /* get device info */
  2055.             regs.x.bx = fileno(outfile);
  2056.             intdos(®s, ®s);
  2057.             regs.h.dl |= 0x20;    /* binary (no ^Z intervention) */
  2058.             regs.h.dh = 0;
  2059.             regs.h.ah = 0x44;    /* ioctl */
  2060.             regs.h.al = 1;        /* set device info */
  2061.             intdos(®s, ®s);
  2062.         }
  2063. #endif
  2064. #endif
  2065.     }
  2066. }
  2067. #endif
  2068.  
  2069. #ifdef vms
  2070. /* these are needed to modify terminal characteristics */
  2071. #include <descrip.h>
  2072. #include <iodef.h>
  2073. #include <ttdef.h>
  2074. #include <tt2def.h>
  2075. #include <dcdef.h>
  2076. #include <ssdef.h>
  2077. #include <stat.h>
  2078. #include <fab.h>
  2079. static unsigned short   chan;
  2080. static int  old_char_buf[3], cur_char_buf[3];
  2081. $DESCRIPTOR(sysoutput_desc,"SYS$OUTPUT");
  2082.  
  2083. char *vms_init()
  2084. /*
  2085.  * Determine if we have a regis terminal
  2086.  * and save terminal characteristics
  2087. */
  2088. {
  2089.    /* Save terminal characteristics in old_char_buf and
  2090.    initialise cur_char_buf to current settings. */
  2091.    int i;
  2092.    sys$assign(&sysoutput_desc,&chan,0,0);
  2093.    sys$qiow(0,chan,IO$_SENSEMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2094.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2095.    sys$dassgn(chan);
  2096.  
  2097.    /* Test if terminal is regis */
  2098.    if ((cur_char_buf[2] & TT2$M_REGIS) == TT2$M_REGIS) return("regis");
  2099.    return(NULL);
  2100. }
  2101.  
  2102. void
  2103. vms_reset()
  2104. /* set terminal to original state */
  2105. {
  2106.    int i;
  2107.    sys$assign(&sysoutput_desc,&chan,0,0);
  2108.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2109.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2110.    sys$dassgn(chan);
  2111. }
  2112.  
  2113. void
  2114. term_mode_tek()
  2115. /* set terminal mode to tektronix */
  2116. {
  2117.    long status;
  2118.    if (outfile != stdout) return; /* don't modify if not stdout */
  2119.    sys$assign(&sysoutput_desc,&chan,0,0);
  2120.    cur_char_buf[0] = 0x004A0000 | DC$_TERM | (TT$_TEK401X<<8);
  2121.    cur_char_buf[1] = (cur_char_buf[1] & 0x00FFFFFF) | 0x18000000;
  2122.  
  2123.    cur_char_buf[1] &= ~TT$M_CRFILL;
  2124.    cur_char_buf[1] &= ~TT$M_ESCAPE;
  2125.    cur_char_buf[1] &= ~TT$M_HALFDUP;
  2126.    cur_char_buf[1] &= ~TT$M_LFFILL;
  2127.    cur_char_buf[1] &= ~TT$M_MECHFORM;
  2128.    cur_char_buf[1] &= ~TT$M_NOBRDCST;
  2129.    cur_char_buf[1] &= ~TT$M_NOECHO;
  2130.    cur_char_buf[1] &= ~TT$M_READSYNC;
  2131.    cur_char_buf[1] &= ~TT$M_REMOTE;
  2132.    cur_char_buf[1] |= TT$M_LOWER;
  2133.    cur_char_buf[1] |= TT$M_TTSYNC;
  2134.    cur_char_buf[1] |= TT$M_WRAP;
  2135.    cur_char_buf[1] &= ~TT$M_EIGHTBIT;
  2136.    cur_char_buf[1] &= ~TT$M_MECHTAB;
  2137.    cur_char_buf[1] &= ~TT$M_SCOPE;
  2138.    cur_char_buf[1] |= TT$M_HOSTSYNC;
  2139.  
  2140.    cur_char_buf[2] &= ~TT2$M_APP_KEYPAD;
  2141.    cur_char_buf[2] &= ~TT2$M_BLOCK;
  2142.    cur_char_buf[2] &= ~TT2$M_DECCRT3;
  2143.    cur_char_buf[2] &= ~TT2$M_LOCALECHO;
  2144.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2145.    cur_char_buf[2] &= ~TT2$M_REGIS;
  2146.    cur_char_buf[2] &= ~TT2$M_SIXEL;
  2147.    cur_char_buf[2] |= TT2$M_BRDCSTMBX;
  2148.    cur_char_buf[2] |= TT2$M_EDITING;
  2149.    cur_char_buf[2] |= TT2$M_INSERT;
  2150.    cur_char_buf[2] |= TT2$M_PRINTER;
  2151.    cur_char_buf[2] &= ~TT2$M_ANSICRT;
  2152.    cur_char_buf[2] &= ~TT2$M_AVO;
  2153.    cur_char_buf[2] &= ~TT2$M_DECCRT;
  2154.    cur_char_buf[2] &= ~TT2$M_DECCRT2;
  2155.    cur_char_buf[2] &= ~TT2$M_DRCS;
  2156.    cur_char_buf[2] &= ~TT2$M_EDIT;
  2157.    cur_char_buf[2] |= TT2$M_FALLBACK;
  2158.  
  2159.    status = sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2160.    if (status == SS$_BADPARAM) {
  2161.       /* terminal fallback utility not installed on system */
  2162.       cur_char_buf[2] &= ~TT2$M_FALLBACK;
  2163.       sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2164.    }
  2165.    else {
  2166.       if (status != SS$_NORMAL)
  2167.          lib$signal(status,0,0);
  2168.    }
  2169.    sys$dassgn(chan);
  2170. }
  2171.  
  2172. void
  2173. term_mode_native()
  2174. /* set terminal mode back to native */
  2175. {
  2176.    int i;
  2177.    if (outfile != stdout) return; /* don't modify if not stdout */
  2178.    sys$assign(&sysoutput_desc,&chan,0,0);
  2179.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,old_char_buf,12,0,0,0,0);
  2180.    for (i = 0 ; i < 3 ; ++i) cur_char_buf[i] = old_char_buf[i];
  2181.    sys$dassgn(chan);
  2182. }
  2183.  
  2184. void
  2185. term_pasthru()
  2186. /* set terminal mode pasthru */
  2187. {
  2188.    if (outfile != stdout) return; /* don't modify if not stdout */
  2189.    sys$assign(&sysoutput_desc,&chan,0,0);
  2190.    cur_char_buf[2] |= TT2$M_PASTHRU;
  2191.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2192.    sys$dassgn(chan);
  2193. }
  2194.  
  2195. void
  2196. term_nopasthru()
  2197. /* set terminal mode nopasthru */
  2198. {
  2199.    if (outfile != stdout) return; /* don't modify if not stdout */
  2200.    sys$assign(&sysoutput_desc,&chan,0,0);
  2201.    cur_char_buf[2] &= ~TT2$M_PASTHRU;
  2202.    sys$qiow(0,chan,IO$_SETMODE,0,0,0,cur_char_buf,12,0,0,0,0);
  2203.    sys$dassgn(chan);
  2204. }
  2205.  
  2206. void
  2207. reopen_binary()
  2208. /* close the file outfile outfile and reopen it with binary type
  2209.    if not already done or outfile == stdout */
  2210. {
  2211.    stat_t stat_buf;
  2212.    char filename[MAX_ID_LEN+1];
  2213.    if (outfile != stdout) { /* don't modify if not stdout */
  2214.       if (!fstat(fileno(outfile),&stat_buf)) {
  2215.          if (stat_buf.st_fab_rfm != FAB$C_FIX) {
  2216.             /* modify only if not already done */
  2217.             (void) fclose(outfile);
  2218.             (void) strcpy(filename,outstr+1);   /* remove quotes */
  2219.             filename[strlen(filename)-1] = '\0';
  2220.             (void) delete(filename);
  2221.             if ((outfile = fopen(filename,"wb","rfm=fix","bls=512","mrs=512"))
  2222.                 == (FILE *)NULL ) {
  2223.                if ( (outfile = fopen(filename,"w")) == (FILE *)NULL ) {
  2224.                  os_error("cannot reopen file with binary type; output unknown",
  2225.                            NO_CARET);
  2226.                }
  2227.                else {
  2228.           os_error("cannot reopen file with binary type; output reset to ascii",
  2229.                            NO_CARET);
  2230.                }
  2231.             }
  2232.          }
  2233.       }
  2234.       else{
  2235.          os_error("cannot reopen file with binary type; output remains ascii",
  2236.                   NO_CARET);
  2237.       }
  2238.    }
  2239. }
  2240.  
  2241. void
  2242. fflush_binary()
  2243. {
  2244.    typedef short int INT16;     /* signed 16-bit integers */
  2245.    register INT16 k;            /* loop index */
  2246.    if (outfile != stdout) {
  2247.        /* Stupid VMS fflush() raises error and loses last data block
  2248.           unless it is full for a fixed-length record binary file.
  2249.           Pad it here with NULL characters. */
  2250.        for (k = (INT16)((*outfile)->_cnt); k > 0; --k)
  2251.           putc('\0',outfile);
  2252.        fflush(outfile);
  2253.    }
  2254. }
  2255. #endif
  2256.